package com.xy.ssm.controller;

import com.xy.ssm.pojo.Dept;
import com.xy.ssm.pojo.Msg;
import com.xy.ssm.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 谢阳
 * @version 1.8.0_131
 * @date 2022/4/2 13:24
 * @description
 */

@Controller
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;

    @GetMapping("/dept")
    @ResponseBody
    public Msg getDepartments() {
        List<Dept> list = departmentService.getAll();
        return Msg.success().add("depts",list);
    }
}
